/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = '';
  
  checkConfig(config);
  @endpoint = getEndpoint('umeng-uapp', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model UwebSiteIdBlockRequest {
  siteId?: string(name='SiteId', description='siteId'),
}

model UwebSiteIdBlockResponseBody = {
  code?: int32(name='Code', description='code'),
  data?: boolean(name='Data'),
  msg?: string(name='Msg', description='msg'),
  requestId?: string(name='RequestId', description='requestId'),
  success?: boolean(name='Success', description='success'),
}

model UwebSiteIdBlockResponse = {
  headers: map[string]string(name='headers'),
  body: UwebSiteIdBlockResponseBody(name='body'),
}

async function uwebSiteIdBlock(request: UwebSiteIdBlockRequest): UwebSiteIdBlockResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return uwebSiteIdBlockWithOptions(request, headers, runtime);
}

async function uwebSiteIdBlockWithOptions(request: UwebSiteIdBlockRequest, headers: map[string]string, runtime: Util.RuntimeOptions): UwebSiteIdBlockResponse {
  Util.validateModel(request);
  var query : map[string]any= {};
  if (!Util.isUnset(request.siteId)) {
    query['SiteId'] = request.siteId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UwebSiteIdBlock',
    version = '2022-02-25',
    protocol = 'HTTPS',
    pathname = `/api/v1/uweb/siteIdBlock`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

